/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PatientAddressInformationPanel.java
 *
 * Created on Aug 13, 2011, 3:58:24 PM
 */
package panels;

import conn.EMIS4Connection;
import dao.AddressDao;
import dao.AddressTypeDao;
import dao.UpdateHistoryDao;
import exec.NotFoundException;
import java.awt.event.ItemEvent;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import main.MainFrame;
import obj.Address;
import obj.AddressType;
import obj.Person;
import obj.UpdateHistory;
import util.PersonRequested;
import verification.WantsValidationStatus;

/**
 *
 * @author NATHAN
 */
public class PatientAddressInformationPanel extends javax.swing.JPanel implements WantsValidationStatus {

  private Address tempAddress;
  private Address primaryAddress;
  private Address secondaryAddress;
  private List<Address> addressList;
  private AddressDao addressDAO;
  private AddressType addressType;
  private List<AddressType> addressTypeList;
  private AddressTypeDao addressTypeDAO;
  private UpdateHistory history;
  private UpdateHistoryDao historyDAO;
  private EMIS4Connection conn = EMIS4Connection.getInstance();
  private PersonRequested pr = PersonRequested.getInstance();
  private int userID;
  private boolean filled;

  /** Creates new form PatientAddressInformationPanel */
  public PatientAddressInformationPanel() {
    tempAddress = new Address();
    primaryAddress = new Address();
    secondaryAddress = new Address();
    addressDAO = new AddressDao();
    addressType = new AddressType();
    addressTypeDAO = new AddressTypeDao();
    history = new UpdateHistory();
    historyDAO = new UpdateHistoryDao();

    initComponents();
    filled = false;
    fillInformation();
    filled = true;

    // fix letters and numbers thing
    //primaryStreetTextField.setInputVerifier(new TextFieldVerifier(this, primaryStreetTextField, "Cannot be empty", Constants.STREET_LENGTH_MIN, Constants.STREET_LENGTH_MAX));
  }

  private void fillInformation() {
    userID = pr.getPerson().getPersonID();
    Person patient = new Person(userID);
    try {
      addressList = addressDAO.searchMatching(conn.getConnection(), new Address(patient));
      addressTypeList = addressTypeDAO.loadAll(conn.getConnection());

      for (AddressType item : addressTypeList) {
        primaryAddressTypeComboBox.addItem(item.getTitle());
        secondaryAddressTypeComboBox.addItem(item.getTitle());
      }

      switch (addressList.size()) {
        // 2 addresses. Fill in secondaryAddressPanel
        case 2:
          secondaryAddress = addressList.get(1);
          secondaryAddressTypeComboBox.setSelectedIndex(secondaryAddress.getAddressTypeID());
          if (secondaryAddress.getAddressTypeID() != 0) {
            if (secondaryAddress.getAddressTypeID() == 1) {
              // hide extra field if it is a home address
              secondaryAptTextField.setVisible(false);
            } else {
              secondaryAptTextField.setText(secondaryAddress.getApt());
            }
            secondaryStreetTextField.setText(secondaryAddress.getStreet());
            secondaryCityTextField.setText(secondaryAddress.getCity());
            secondaryStateComboBox.setSelectedItem(secondaryAddress.getState());
            secondaryZipTextField.setText(String.valueOf(secondaryAddress.getZip()));
          }

        // 1 address. Fill in primaryAddressPanel
        case 1:
          primaryAddress = addressList.get(0);
          primaryAddressTypeComboBox.setSelectedIndex(primaryAddress.getAddressTypeID());
          if (primaryAddress.getAddressTypeID() != 0) {
            if (primaryAddress.getAddressTypeID() == 1) {
              // hide extra field if it is a home address
              primaryAptTextField.setVisible(false);
            } else {
              primaryAptTextField.setText(primaryAddress.getApt());
            }
            primaryStreetTextField.setText(primaryAddress.getStreet());
            primaryCityTextField.setText(primaryAddress.getCity());
            primaryStateComboBox.setSelectedItem(primaryAddress.getState());
            primaryZipTextField.setText(String.valueOf(primaryAddress.getZip()));
          }
      }
    } catch (SQLException ex) {
      Logger.getLogger(PatientAddressInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    warningDialog = new javax.swing.JDialog();
    warningLabel = new javax.swing.JLabel();
    warningButton = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    primaryAddressPanel = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    primaryAddressTypeComboBox = new javax.swing.JComboBox();
    primaryStreetTextField = new javax.swing.JTextField();
    primaryAptTextField = new javax.swing.JTextField();
    primaryCityTextField = new javax.swing.JTextField();
    primaryStateComboBox = new javax.swing.JComboBox();
    primaryZipTextField = new javax.swing.JFormattedTextField();
    secondaryAddressPanel = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    secondaryAddressTypeComboBox = new javax.swing.JComboBox();
    secondaryStreetTextField = new javax.swing.JTextField();
    secondaryAptTextField = new javax.swing.JTextField();
    secondaryCityTextField = new javax.swing.JTextField();
    secondaryStateComboBox = new javax.swing.JComboBox();
    secondaryZipTextField = new javax.swing.JFormattedTextField();
    submitButton = new javax.swing.JButton();

    warningDialog.setTitle("Warning!");
    warningDialog.setAlwaysOnTop(true);
    warningDialog.setMinimumSize(new java.awt.Dimension(240, 100));
    warningDialog.setModal(true);
    warningDialog.getContentPane().setLayout(new java.awt.GridBagLayout());

    warningLabel.setText("Message goes here");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
    gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE;
    gridBagConstraints.insets = new java.awt.Insets(15, 0, 10, 0);
    warningDialog.getContentPane().add(warningLabel, gridBagConstraints);

    warningButton.setText("OK");
    warningButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        warningButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    warningDialog.getContentPane().add(warningButton, gridBagConstraints);

    setBackground(new java.awt.Color(220, 220, 210));
    setLayout(new java.awt.GridBagLayout());

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24));
    jLabel1.setText("Address Information");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(20, 15, 10, 0);
    add(jLabel1, gridBagConstraints);

    primaryAddressPanel.setBackground(new java.awt.Color(220, 220, 210));
    primaryAddressPanel.setLayout(new java.awt.GridBagLayout());

    jLabel2.setText("Primary:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(10, 8, 0, 0);
    primaryAddressPanel.add(jLabel2, gridBagConstraints);

    primaryAddressTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
      public void itemStateChanged(java.awt.event.ItemEvent evt) {
        primaryAddressTypeComboBoxItemStateChanged(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 55, 0, 0);
    primaryAddressPanel.add(primaryAddressTypeComboBox, gridBagConstraints);

    primaryStreetTextField.setText("Street");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    primaryAddressPanel.add(primaryStreetTextField, gridBagConstraints);

    primaryAptTextField.setText("Apt/Suite");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    primaryAddressPanel.add(primaryAptTextField, gridBagConstraints);

    primaryCityTextField.setText("City");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    primaryAddressPanel.add(primaryCityTextField, gridBagConstraints);

    primaryStateComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "State", "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" }));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    primaryAddressPanel.add(primaryStateComboBox, gridBagConstraints);

    try {
      primaryZipTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    primaryZipTextField.setMinimumSize(new java.awt.Dimension(40, 20));
    primaryZipTextField.setPreferredSize(new java.awt.Dimension(40, 20));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    primaryAddressPanel.add(primaryZipTextField, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 0);
    add(primaryAddressPanel, gridBagConstraints);

    secondaryAddressPanel.setBackground(new java.awt.Color(220, 220, 210));
    secondaryAddressPanel.setLayout(new java.awt.GridBagLayout());

    jLabel3.setText("Secondary:");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(10, 8, 0, 0);
    secondaryAddressPanel.add(jLabel3, gridBagConstraints);

    secondaryAddressTypeComboBox.addItemListener(new java.awt.event.ItemListener() {
      public void itemStateChanged(java.awt.event.ItemEvent evt) {
        secondaryAddressTypeComboBoxItemStateChanged(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 70, 0, 0);
    secondaryAddressPanel.add(secondaryAddressTypeComboBox, gridBagConstraints);

    secondaryStreetTextField.setText("Street");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    secondaryAddressPanel.add(secondaryStreetTextField, gridBagConstraints);

    secondaryAptTextField.setText("Apt/Suite");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    secondaryAddressPanel.add(secondaryAptTextField, gridBagConstraints);

    secondaryCityTextField.setText("City");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    secondaryAddressPanel.add(secondaryCityTextField, gridBagConstraints);

    secondaryStateComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "State", "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" }));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    secondaryAddressPanel.add(secondaryStateComboBox, gridBagConstraints);

    try {
      secondaryZipTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    secondaryZipTextField.setMinimumSize(new java.awt.Dimension(40, 20));
    secondaryZipTextField.setPreferredSize(new java.awt.Dimension(40, 20));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
    secondaryAddressPanel.add(secondaryZipTextField, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    add(secondaryAddressPanel, gridBagConstraints);

    submitButton.setText("Submit");
    submitButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        submitButtonActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(20, -30, 10, 1);
    add(submitButton, gridBagConstraints);
  }// </editor-fold>//GEN-END:initComponents

private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
  boolean changed = false;
  int oldInt, newInt;
  String oldString, newString;

  try {
    conn.connect();

    // update/create primary address
    if (primaryAddressTypeComboBox.getSelectedIndex() != 0) {
      // update
      if (primaryAddress.getAddressID() > 0) {
        System.out.println("PRIMARY ADDRESS UPDATE: HISTORY TRACKING");
        // check type
        oldInt = primaryAddress.getAddressTypeID();
        newInt = primaryAddressTypeComboBox.getSelectedIndex();
        if (oldInt != newInt) {
          // type changed
          primaryAddress.setAddressTypeID(newInt);
          history.setAll("Address", primaryAddress.getAddressID(), "Address_Type_ID", "Changed primary address type", String.valueOf(oldInt), String.valueOf(newInt));
          historyDAO.create(conn.getConnection(), history);
        }

        // check street

        // check apt

        // check city

        // check state

        // check zip

        // TODO history tracking
      } else {
        // create        
        tempAddress.setAll(userID, primaryStreetTextField.getText(), primaryAptTextField.getText(),
                primaryCityTextField.getText(), primaryStateComboBox.getSelectedItem().toString(),
                Integer.valueOf(primaryZipTextField.getText()), primaryAddressTypeComboBox.getSelectedIndex());
        changed = true;
        addressDAO.create(conn.getConnection(), tempAddress);
      }
    } else if (primaryAddress.getAddressID() > 0) {
      popupMessage("Primary address cannot be \"NONE\"!");
      return;
    }

    // update/create secondary address
    if (secondaryAddressTypeComboBox.getSelectedIndex() != 0) {
      // update
      if (secondaryAddress.getAddressID() > 0) {
        System.out.println("SECONDARY ADDRESS UPDATE: HISTORY TRACKING");
        // TODO history tracking
      } else {
        // create
        tempAddress = new Address();
        tempAddress.setAll(userID, secondaryStreetTextField.getText(), secondaryAptTextField.getText(),
                secondaryCityTextField.getText(), secondaryStateComboBox.getSelectedItem().toString(),
                Integer.valueOf(secondaryZipTextField.getText()), secondaryAddressTypeComboBox.getSelectedIndex());
        changed = true;
        addressDAO.create(conn.getConnection(), tempAddress);
      }
    } else if (secondaryAddress.getAddressID() > 0) {
      // delete
      addressDAO.delete(conn.getConnection(), secondaryAddress);
      popupMessage("Secondary address DELETED!");
      Dashboard.getTabPane().setComponentAt(Dashboard.getTabPane().getSelectedIndex(), new PatientAddressInformationPanel());
      return;
    }

    if (changed) {
      popupMessage("Changes saved!");
    } else {
      popupMessage("No changes made.");
    }
  } catch (SQLException ex) {
    Logger.getLogger(PatientAddressInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
  } catch (NotFoundException ex) {
    Logger.getLogger(PatientAddressInformationPanel.class.getName()).log(Level.SEVERE, null, ex);
  }
}//GEN-LAST:event_submitButtonActionPerformed

private void warningButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_warningButtonActionPerformed
  warningDialog.setVisible(false);
}//GEN-LAST:event_warningButtonActionPerformed

private void primaryAddressTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_primaryAddressTypeComboBoxItemStateChanged
  if (filled && evt.getStateChange() == ItemEvent.SELECTED) {
    String item = (String) evt.getItem();
    if (item.equals("Home")) {
      primaryAptTextField.setVisible(false);
    } else {
      if (!primaryAptTextField.isVisible()) {
        primaryAptTextField.setVisible(true);
      }
    }
    this.validate();
  }
}//GEN-LAST:event_primaryAddressTypeComboBoxItemStateChanged

private void secondaryAddressTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_secondaryAddressTypeComboBoxItemStateChanged
  if (filled && evt.getStateChange() == ItemEvent.SELECTED) {
    String item = (String) evt.getItem();
    if (item.equals("Home")) {
      secondaryAptTextField.setVisible(false);
    } else {
      if (!secondaryAptTextField.isVisible()) {
        secondaryAptTextField.setVisible(true);
      }
    }
    this.validate();
  }
}//GEN-LAST:event_secondaryAddressTypeComboBoxItemStateChanged
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JPanel primaryAddressPanel;
  private javax.swing.JComboBox primaryAddressTypeComboBox;
  private javax.swing.JTextField primaryAptTextField;
  private javax.swing.JTextField primaryCityTextField;
  private javax.swing.JComboBox primaryStateComboBox;
  private javax.swing.JTextField primaryStreetTextField;
  private javax.swing.JFormattedTextField primaryZipTextField;
  private javax.swing.JPanel secondaryAddressPanel;
  private javax.swing.JComboBox secondaryAddressTypeComboBox;
  private javax.swing.JTextField secondaryAptTextField;
  private javax.swing.JTextField secondaryCityTextField;
  private javax.swing.JComboBox secondaryStateComboBox;
  private javax.swing.JTextField secondaryStreetTextField;
  private javax.swing.JFormattedTextField secondaryZipTextField;
  private javax.swing.JButton submitButton;
  private javax.swing.JButton warningButton;
  private javax.swing.JDialog warningDialog;
  private javax.swing.JLabel warningLabel;
  // End of variables declaration//GEN-END:variables

  @Override
  public void validateFailed() {
  }

  @Override
  public void validatePassed() {
  }

  private void popupMessage(String msg) {
    warningLabel.setText(msg);
    warningDialog.pack();
    warningDialog.setLocationRelativeTo(MainFrame.getInstance());
    warningDialog.setVisible(true);
  }
}
